package com.lu.pojo.oop.anonymous;

/**
 * @author luzhenfang
 * @date 2020 05 16
 * @description 匿名类
 */
public class TestAnonym {
    public static void main(String[] args) {
        // 没有名字初始化类，不用将实例保存到变量中
        new Anonym().method();
        UserService userService = new UserService() {
            @Override
            public void get() {
                System.out.println("get方法!");
            }

            @Override
            public void post() {
                System.out.println("post方法!");

            }
        };
        userService.get();
        userService.post();
    }
}
